package com.leha.mp.core.Utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.leha.mp.core.constants.BizConstants;
import com.leha.utils.DateTool;
import lombok.extern.log4j.Log4j2;

import java.util.Date;

@Log4j2
public class BizTransferHelper {
    public static  String ConsultingTypeToDesc(Byte consultingType) {
        switch (consultingType) {
            case BizConstants.Product_Type_Msg:
                return "图文咨询";
            case BizConstants.Product_Type_Phone:
                return "电话咨询";
            case BizConstants.Product_Type_Video:
                return "视频咨询";
            default:
                return "私人医生";
        }
    }

    public static String ConsultingDecode(String extraData, String key, String defalut) {
        try {
            JSONObject obj = JSON.parseObject(extraData);
            if(obj.containsKey(key)) {
                return obj.getString(key);
            }
        } catch (Exception e){
            log.error("JsonDecode Error：content:"+extraData);
        }
        return defalut;
    }
}
